package com.omybug.study.entity;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextClosedEvent;
import org.springframework.stereotype.Component;

/**
 * @author: omybug
 * @date: 18/9/26 10:53
 */
@Component
public class MyListener implements ApplicationListener<ApplicationEvent> {

    public void onApplicationEvent(ApplicationEvent event) {
        System.out.println(".. onApplicationEvent..");
        if(event instanceof ContextClosedEvent){
            System.out.println("ContextClosedEvent");
        }else{
            System.out.println(event.toString());
        }

    }
}
